package InternetConnection;

import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.net.Socket;

import library.protocol.MemberInfo;

public class ConnectionInfo {
	private final static ConnectionInfo loginInfo = new ConnectionInfo();

	private int ServerPort;
	private String ServerIP;
	boolean isConnected;
	private Socket socket;
	private ObjectOutputStream networkWriter;
	private ObjectInputStream networkReader;
	private MemberInfo userInfo = null;
	private boolean loginState;

	public ConnectionInfo() {
		this.isConnected = false;
		this.loginState = false;
	}

	public static ConnectionInfo getInstance() {
		return loginInfo;
	}

	public boolean isLogin() {
		return loginState;
	}

	public void setMember(MemberInfo mem) {
		this.userInfo = mem;
		this.loginState = true;
	}

	public MemberInfo getMember() {
		return this.userInfo;
	}

	public void setIP(String ip) {
		this.ServerIP = ip;
	}

	public void setPort(int port) {
		this.ServerPort = port;
	}

	public void setSocket(Socket socket) {
		this.socket = socket;
	}

	public void setInputStream(ObjectInputStream oin) {
		this.networkReader = oin;
	}

	public void setOutputStream(ObjectOutputStream oos) {
		this.networkWriter = oos;
	}

	public void setConnection(boolean isConnection) {
		this.isConnected = isConnection;
	}

	public ObjectOutputStream getOutputStream() {
		return networkWriter;
	}

	public ObjectInputStream getInputStream() {
		return networkReader;
	}

	public Socket getSocket() {
		return this.socket;
	}

	public boolean getConnection() {
		return this.isConnected;
	}

}
